package com.luoye.ct.ws.resource;

import com.luoye.ct.service.IHelloService;
import com.luoye.ct.service.model.UserInfo;
import com.luoye.ct.ws.data.UserData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2018/6/2.
 */
@RestController
@RequestMapping("/hello")
public class HelloResource {
    @Autowired
    private IHelloService helloService;


    @RequestMapping(value="/say",method = RequestMethod.GET)
    public UserData say(@RequestParam("name") String name){
        UserData userData=new UserData();
        UserInfo userInfo=helloService.say(name);
        userData.setUserId(userInfo.getUserId());
        userData.setUserName(userInfo.getUserName());
        return userData;
    }
}
